#ifndef _MY_TRUNC_H_
#define _MY_TRUNC_H_

#include <stdint.h>
//大端cpu
//typedef union 
//{
//  double value;
//  struct 
//  {
//    uint32_t msw;
//    uint32_t lsw;
//  } parts;
//} ieee_double_shape_type;
//little
typedef union 
{
  double value;
  struct 
  {
    uint32_t lsw;
    uint32_t msw;
  } parts;
} ieee_double_shape_type;



#define INSERT_WORDS(d,ix0,ix1)		\
do {								 \
  ieee_double_shape_type iw_u;		 \
  iw_u.parts.msw = (ix0);			 \
  iw_u.parts.lsw = (ix1);			 \
  (d) = iw_u.value;					 \
} while (0)

#define EXTRACT_WORDS(ix0,ix1,d)	 \
do {								 \
  ieee_double_shape_type ew_u;		 \
  ew_u.value = (d);				     \
  (ix0) = ew_u.parts.msw;			 \
  (ix1) = ew_u.parts.lsw;			\
} while (0)

double my_trunc(double x);
#endif